<template>
    <div class="mx-radio-group">
        <slot></slot>
    </div>
</template>

<script>
export default {
    name: 'RadioGroup',
    model: {
        props: 'value',
        event: 'change',
    },
    props: {
        value: {
            type: [Number, String],
        },
    },
    data() {
        return {
            curValue: this.value,
        }
    },
    mounted() {
        this.init()
    },
    methods: {
        init() {
            this.curValue = this.value
        },
        updateValue(val) {
            this.curValue = val
            this.$emit('change', this.curValue)
        },
    },
    watch: {
        value(val, val1) {
            this.curValue = val
        },
    },
}
</script>
